﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media.Imaging;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Com.AMap.Search.API;
using Com.AMap.Maps.Api;
using Com.AMap.Maps.Api.Events;
using Com.AMap.Maps.Api.BaseTypes;
using Com.AMap.Maps.Api.Enums;
using Com.AMap.Maps.Api.Layers;
using Com.AMap.Maps.Api.Overlays;
using Com.AMap.Search.API;
using Com.AMap.Search.API.Options;
using Microsoft.Phone.Controls;
using System.Device.Location;
using System.Collections.ObjectModel;
using Com;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO.IsolatedStorage;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.IO;
using System.Threading;

namespace wpapp
{
    public partial class login : PhoneApplicationPage
    {
        public login()
        {
           
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            App.logid = txtUN.Text.ToString();
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
        }

        private void rd1_Checked(object sender, RoutedEventArgs e)
        {
            rd2.IsChecked = false;
            txtPW2.Visibility = Visibility.Collapsed;
            textBlock4.Visibility = Visibility.Collapsed;
            button1.Content = "登陆";
        }

        private void rd2_Checked(object sender, RoutedEventArgs e)
        {
            rd1.IsChecked = false;
            txtPW2.Visibility = Visibility.Visible;
            textBlock4.Visibility = Visibility.Visible;
            button1.Content = "注册新用户";
        }

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            rd1.IsChecked = true;
        }

        private void txtUN_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            TextBox tbx = (TextBox)sender;

            if (e.Key == Key.Enter)
            {
                this.Focus();
            }
        }

        private void txtPW_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {

            if (e.Key == Key.Enter)
            {
                this.Focus();
            }
        }

        private void txtPW2_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
         

            if (e.Key == Key.Enter)
            {
                this.Focus();
            }
        }
    }
}